﻿using System.Collections.Generic;

namespace NExplorer
{
	public abstract class MenuBuilder : IMenuBuilder
	{
		private List<MenuCommandInfo> _infos;

		protected abstract void AddCommands();

		public IList<MenuCommandInfo> GetMenuCommandInfos()
		{
			_infos = new List<MenuCommandInfo>();

			AddCommands();

			return _infos;
		}

		protected void Add(ICommand command, string category)
		{
			_infos.Add(new MenuCommandInfo(command, category));
		}

		protected void Add<T>(string category) where T : ICommand, new()
		{
			Add(new T(), category);
		}

	}
}
